﻿namespace Vdc.Grid
{
    using System;
    using System.Collections;
    using System.Reflection;

    public class TemplatesCollection : CollectionBase
    {
        public void Add(GridRuntimeTemplate oGridTemplate)
        {
            base.List.Add(oGridTemplate);
        }

        public void Add(GridTemplate oGridTemplate)
        {
            base.List.Add(oGridTemplate);
        }

        public GridTemplate GetById(string sId)
        {
            foreach (GridTemplate template in base.List)
            {
                if (template.ID.ToString() == sId)
                {
                    return template;
                }
            }
            return new GridTemplate();
        }

        public GridRuntimeTemplate GetRuntimeTemplateById(string sId)
        {
            foreach (GridRuntimeTemplate template in base.List)
            {
                if (template.ID.ToString() == sId)
                {
                    return template;
                }
            }
            return new GridRuntimeTemplate();
        }

        public void Remove(int i)
        {
            base.List.RemoveAt(i);
        }

        public GridTemplate this[int index]
        {
            get
            {
                return (GridTemplate) base.List[index];
            }
        }
    }
}

